home *** CD-ROM | disk | FTP | other *** search
- Path: seas.smu.edu!not-for-mail
- From: dbowman@post.smu.edu (Damon Bowman)
- Newsgroups: comp.lang.c++
- Subject: beginner question - typecasting
- Date: 3 Jan 1996 12:31:23 -0600
- Organization: Southern Methodist University
- Sender: usenet@seas.smu.edu
- Message-ID: <4cei1r$s02@sun.cis.smu.edu>
- Reply-To: dbowman@post.smu.edu
- NNTP-Posting-Host: sun.cis.smu.edu
- X-Nntp-Posting-Host: ax4-10.ppp.smu.edu
- X-Newsreader: Forte Free Agent 1.0.82
-
-
- When you are typecasting, is there any difference between:
-
- a = int(x)
- and
- a = (int) x
-
- My book (Teach Yourself Visual C++ 1.5 in 21 Days, Revised Edition, by
- Shammas) says both forms are supported, but doesnÆt say which should
- be used, or if it matters.
-
- The specific example given is:
-
- int i = 2;
- float a, b;
- a = float(i);
- b = (float) i;
-
- In this example, would a and b return the same value and have the same
- data type (float)?
-
-
-